# 车库门
def catDoor_num(device, on_off):
    global to_send_Garaedoor
    if device == 'catDoor' and on_off == True:
        to_send_Garaedoor = '1'
    elif device == 'catDoor' and on_off == False:
        to_send_Garaedoor = '2'
    elif device == 'catDoor' and on_off == 2:
        to_send_Garaedoor = '0'
    else:
        to_send_Garaedoor = '9'
    return to_send_Garaedoor


# 门
# 门模式一
def door_num(device, work_mode, on_off):
    global to_send_Gate
    if device == 'door' and work_mode == 1 and on_off == 2:
        to_send_Gate = '10'
    elif device == 'door' and work_mode == 1 and on_off == True:
        to_send_Gate = '11'
    elif device == 'door' and work_mode == 1 and on_off == False:
        to_send_Gate = '12'
    # 门模式二
    elif device == 'door' and work_mode == 2 and on_off == 2:
        to_send_Gate = '20'
    elif device == 'door' and work_mode == 2 and on_off == True:
        to_send_Gate = '21'
    elif device == 'door' and work_mode == 2 and on_off == False:
        to_send_Gate = '22'
    # 门模式三
    elif device == 'door' and work_mode == 3 and on_off == 2:
        to_send_Gate = '30'
    elif device == 'door' and work_mode == 3 and on_off == True:
        to_send_Gate = '31'
    elif device == 'door' and work_mode == 3 and on_off == False:
        to_send_Gate = '32'
    # 门模式四
    elif device == 'door' and work_mode == 4 and on_off == 2:
        to_send_Gate = '40'
    elif device == 'door' and work_mode == 4 and on_off == True:
        to_send_Gate = '41'
    elif device == 'door' and work_mode == 4 and on_off == False:
        to_send_Gate = '42'
    else:
        to_send_Gate = '99'
    return to_send_Gate


# 窗户模式一
def window_num(device, work_mode, on_off):
    global to_send_Window
    if device == 'window' and work_mode == 1 and on_off == 2:
        to_send_Window = '10'
    elif device == 'window' and work_mode == 1 and on_off == True:
        to_send_Window = '11'
    elif device == 'window' and work_mode == 1 and on_off == False:
        to_send_Window = '12'
    # 窗户模式二
    elif device == 'window' and work_mode == 2 and on_off == 2:
        to_send_Window = '20'
    elif device == 'window' and work_mode == 2 and on_off == True:
        to_send_Window = '21'
    elif device == 'window' and work_mode == 2 and on_off == False:
        to_send_Window = '22'
    # 窗户模式三
    elif device == 'window' and work_mode == 3 and on_off == 2:
        to_send_Window = '30'
    elif device == 'window' and work_mode == 3 and on_off == True:
        to_send_Window = '31'
    elif device == 'window' and work_mode == 3 and on_off == False:
        to_send_Window = '32'
    else:
        to_send_Window = '99'
    return to_send_Window


# 灯模式一
def light_num(device, work_mode, on_off):
    global to_send_Light
    if device == 'light' and work_mode == 1 and on_off == False:
        to_send_Light = '10'
    elif device == 'light' and work_mode == 1 and on_off == True:
        to_send_Light = '11'
    # 灯模式二
    elif device == 'light' and work_mode == 2 and on_off == False:
        to_send_Light = '20'
    elif device == 'light' and work_mode == 2 and on_off == True:
        to_send_Light = '21'
    # 灯模式三
    elif device == 'light' and work_mode == 3 and on_off == False:
        to_send_Light = '31'
    elif device == 'light' and work_mode == 3 and on_off == True:
        to_send_Light = '31'
    else:
        to_send_Light = '99'
    return to_send_Light
